package com.gitee.wsl.prism4j

abstract class AbsVisitor : Prism4j.Visitor {
    override fun visit(nodes: List<Prism4j.Node>) {
        for (node in nodes) {
            if (node.isSyntax) {
                visitSyntax(node as Prism4j.Syntax)
            } else {
                visitText(node as Prism4j.Text)
            }
        }
    }

    protected abstract fun visitText(text: Prism4j.Text)

    // do not forget to call visit(syntax.children()) inside
    protected abstract fun visitSyntax(syntax: Prism4j.Syntax)
}
